#include "mystdio.h"
#include <string.h>
#include <unistd.h>

int main()
{
    MY_FILE* fp = my_fopen("log.txt","a");
    int fb = fp->fileno;
    printf("%d\n",fb);
    if(fp == NULL)
    {
        perror("my_fopen:");
        return -1;
    }

    //带\n
    //const char* msg = "HEllO my_fwrite\n";
    
    //不带\n测试
    int cnt = 10;
    while(cnt--)
    {
      const char* msg = "HEllO my_fwrite!!!"; 
      my_fwrite(msg,1,strlen(msg),fp);
        
      //打印缓冲区内容
      printf("buffer:%s\n",fp->outbuffer);
      printf("---\n");
      sleep(1);
    }


    my_fclose(fp);
    return 0;
}
